{%extends 'base.html'%}
{%from '_form_render.html' import render_field%}

{%block title%}邮箱未验证！请先验证邮箱！{%endblock%}
{%block content%}
<h1 class="text-center">
    {%if not current_user.confirmed%}
    邮箱未验证！请先验证邮箱！
    {%else%}
    邮箱已验证
    {%endif%}
</h1>
<h1 class="text-center">重新验证邮箱？<a href="#" data-toggle="modal" data-target="#myModal" style="color: red;">点击重新验证</a></h1>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">验证邮箱</h4>
      </div>
      <div class="modal-body">
        <form action="" method="post" class="form" role="form">
            {{ form.hidden_tag() }}
            {{ render_field(form.email) }}
            {{ render_field(form.recaptcha) }}
            <img id='recaptcha' src="{{url_for('auth.generate_code')}}"/>
            <input class="btn btn-default" id="submit" name="submit" type="submit" value="提交">
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary">关闭</button>
      </div>
    </div>
  </div>
</div>
<script type='text/javascript'>
    $(function(){
        $('img#recaptcha').on('click', function(){
            $(this).attr('src', ($(this).attr('src'))+'?'+Math.random())
        })
    });
</script>
{%endblock%}

